import {workOrderModifyList} from "@/api/workorder/modifyOrder";
import { stringToObject } from "@/util/util";

export default {
  hasPage: true,
  hasCheck: true,
  request: (params) => {
    return workOrderModifyList(params)
  },
  dataParse: (res) => {
    const resData = res.data.data || {}
    const data = {
      list: (resData.rows || []).map(item => {
        return {
          ...item,
          beforExtJson: item.beforExtJson ? stringToObject(item.beforExtJson) : {},
          extJson: item.extJson ? stringToObject(item.extJson) : {},
        }
      }),
      total: resData.total
    }
    return data
  },
  columns: [
    {
      prop: 'cityName',
      label: '城市',
    },
    {
      prop: 'xmbzNo',
      label: '后台单号',
    },
    {
      prop: 'platformOrderId',
      label: '平台单号',
    },
    {
      prop: 'operator',
      label: '申请人',
    },
    {
      prop: 'reason',
      label: '修改原因',
    },
    {
      prop: 'beforExtJson',
      label: '修改前内容',
      width: '300px',
      isSlot: true,
    },
    {
      prop: 'extJson',
      label: '修改后内容',
      width: '300px',
      isSlot: true,
    },
    {
      prop: 'personDispose',
      label: '处理人',
    },
    {
      prop: 'handleState',
      label: '处理状态',
      isSlot: true,
    },
    {
      prop: 'source',
      label: '订单来源',
      isSlot: true,
    },
    {
      prop: 'createTime',
      label: '创建时间',
      sortable: 'custom',
      width: '160px',
    },
    {
      prop: 'endTime',
      label: '完结时间',
      width: '160px',
    },
    {
      prop: 'operate',
      label: '操作',
      width: '280px',
      isSlot: true,
    }
  ]
}